$('#new_jiaoshi').click(function() {
  $('.mail-body').load('YongGongJiaoShi_add.html');
})
$('#ListTitle').html(BuMenName + '用工教师列表');
$.getJSON('YongGongJiaoShi_list.php', {
    BuMenId: BuMenId
  },
  function(data, textStatus, jqXHR) {
    for (let i = 0; i < data.length; i++) {
      $('#ListArea').append(
        '<tr>  ' +
        '  <td>' + data[i].XingMing + '</td><td>' + data[i].XueHao + '</td> ' +
        '  <td> ' +
        '    <a person_id="' + data[i].id + '" href="javascript:" class="btn btn-default btn-xs red person_del"><i class="fa fa-trash-o"></i>删除</a> ' +
        '  </td> ' +
        '</tr>'
      );
    }
    optAction();
  }
);

function optAction() {
  $('.person_del').click(function() {
    var person_id = $(this).attr('person_id');
    if (window.confirm('是否确认删除?')) {
      $.getJSON('YongGongJiaoShi_del.php', {
          person_id: person_id
        },
        function(data, textStatus, jqXHR) {
          $('.mail-body').load('YongGongJiaoShi_list.html');
        }
      );
    }
  })
}
